<?php
class product_model extends CI_Model
{
    protected $_table = "mock_products";
    public function __construct(){
        parent::__construct();
    }
    public function getProduct(){
        return $this->db->get($this->_table)->result_array();
    }
    public function update($id,$data){
        $this->db->where("product_id",$id);
        $this->db->update($this->_table,$data);
    }
    public function getdata($id){
        $this->db->where("product_id",$id);
        return $this->db->get($this->_table)->row_array();
    }
    public function addProduct($data){
        $this->db->insert($this->_table,$data);
    }
    function save_image($field,$filename=''){

        if($filename!=''){
            $data[$field] = $filename;
        }
        $this->db->where('id',1);// item  id
        $this->db->update($this->_table,$data);
    }

}